home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODF-Interest Archive / May 96 / ODF R1 RefCounting Extensio < prev    next >
Encoding:
Internet Message Format  |  1996-12-03  |  1.6 KB  |  [TEXT/ttxt]

  1. Subject:     ODF R1 RefCounting Extensio
  2. Sent:        5/30/96 4:32 PM
  3. Received:    5/30/96 4:51 PM
  4. From:        Kirk Swenson, kswenson@mail.keypress.com
  5. Reply-To:    ODF Interest, ODF-Interest@CILabs.ORG
  6. To:          OpenDoc Development Framework Discussion List, ODF-Interest@CILabs.
  7.  
  8. In ODF R1, calling FW_CExtensionManager::AcquireExtension() for our extension
  9. never Acquire()'s the extension if it has to create it, so the refcount
  10. remains 0, and a subsequent Release() leads to a warning from OpenDoc.  For a
  11. cached part such as ours, subsequent uses of the extension don't have a
  12. problem because FW_CExtensionManager::AcquireExtension() does Acquire() the
  13. extension if it is only retrieving it from the cache.
  14.  
  15. I suspect that the line:
  16.  
  17.     acquiredExtension->Acquire(ev);
  18.  
  19. should be inserted into the following code in
  20. FW_CExtensionManager::AcquireExtension:
  21.  
  22.     if (pair->fValue.fCreateFunction)
  23.                 {
  24.         acquiredExtension = (pair->fValue.fCreateFunction)
  25.                                 (ev, fPart, name, pair->fValue.fRefCon);
  26.         acquiredExtension->Acquire(ev);  // New line to increment refcount
  27.                        pair->fValue.fExtension = acquiredExtension;
  28.                 }
  29.  
  30. Alternatively, the extension's CreateFunction could Acquire() the extension,
  31. but the documentation does not indicate this and it seems inappropriate to
  32. me.  One might want to create the extension before there are any clients (for
  33. caching purposes, for instance).
  34.  
  35. Is this a bug in FW_CExtensionManager::AcquireExtension, or have I missed
  36. something?
  37.  
  38. Kirk Swenson
  39. Senior Software Engineer
  40. Key Curriculum Press
  41. kswenson@keypress.com
  42.  
  43.